﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;

namespace PseudoSmash
{
    public class Player : DrawableGameComponent
    {
        public const int NO_ATTACK = -1;
        public const int LIGHT_ATTACK = 0;
        public const int HEAVY_ATTACK = 1;
        public const int SPECIAL_ATTACK_ONE = 2;
        public const int SPECIAL_ATTACK_TWO = 3;
        public const int AIRLIGHT_ATTACK = 4;
        public const int AIRHEAVY_ATTACK = 5;
        public const int AIRSPECIAL_ATTACK = 6;
        public const int SUPER_ATTACK = 7;
        public const int GRAB = 8;
        public const int THROW = 9;

        public const int NP_DEAD = -1;
        public const int NEUTRAL = 0;
        public const int RUN = 1;
        public const int ATTACK = 2;
        public const int JUMP = 3;
        public const int SHIELD = 4;
        public const int JUMP_ATTACK = 5;
        public const int HIT_STUN = 6;
        public const int HIT_AIR_STUN = 7;
        public const int LANDING = 8;
        public const int THROWN = 9;

        public const int RIGHT = 1;
        public const int LEFT = -1;

        public Boolean isAI;

        public Boolean bugMode;
        public int bugTimer;
        public Boolean gameOn;

        public int state;                           //player state
        public int attackState;                     //attack currently being executed
        public SpriteBatch spriteBatch;
        public Texture2D spriteSheet;               //sprite sheet
        public spriteFrame curSpriteRect;             //rectangle of current sprite to draw
        public Vector2 Position { get; set; }       //player position
        public Vector2 Velocity { get; set; }       //player velocity
        public int direction { get; set; }          //player direction
        public int pain { get; set; }                //pain (hp). 101 == dead

        public Vector2 offset { get; set; }

        public spriteFrame hitstunned;
        public spriteFrame[] blockingLoop;
        public spriteFrame[] jumpLoop;
        public spriteFrame[] standingLoop;          //collection of rectangles for standing animation loop
        public spriteFrame[] runLoop;              //collection of rectanglegs for walk animation loop
        public spriteFrame[][] attackLoop;          //collection of rectangles for attack animation loop
        public spriteFrame landing;
        public int animCounter;                      //counter used to loop through animations

        public Rectangle trueAttackHitbox { get; set; }
        public Rectangle trueHitBox { get; set; } 

        public int lag;                             //used to count lag frames
        public int hitStunCounter;                  //used to count hit-stun
        public int[] hitInvulnCounter;            //small invuln from another player after being hit (prevents multiple hits on the same attack)
        public int[] hitInvulnMove;                 //which move they are invlunerable to
        public int superCounter;                    //fills up super bar
        public int thrownDirection;                 //the direction they are being thrown in 


        public int playerNum;
        public int playerType;


        public Player(Game g, Vector2 startPos, int pn, int pt)
            : base(g)
        {
            isAI = false;
            playerNum = pn;
            playerType = pt;
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            curSpriteRect = new spriteFrame(new Rectangle(), new Rectangle(), new Rectangle());

            gameOn = false;
            bugMode = false;
            bugTimer = 0;
           
            Position = startPos;
            Velocity = new Vector2(0, 0);
            state = NEUTRAL;
            direction = LEFT;
            pain = 0;
            attackState = NO_ATTACK;
            animCounter = 0;
            hitStunCounter = 0;
            hitInvulnCounter = new int[4];
            hitInvulnCounter[0] = -1;
            hitInvulnCounter[1] = -1;
            hitInvulnCounter[2] = -1;
            hitInvulnCounter[3] = -1;
            hitInvulnMove = new int[4];
            hitInvulnMove[0] = -1;
            hitInvulnMove[1] = -1;
            hitInvulnMove[2] = -1;
            hitInvulnMove[3] = -1;
            lag = 0;

            base.LoadContent();
        }

        public override void Draw(GameTime gameTime)
        {
            if (gameOn == false)
                return;

            //Vector2 offset = new Vector2(curSpriteRect.Width / 2, curSpriteRect.Height / 2);
            if (direction == RIGHT)
            {
                spriteBatch.Begin();
                if (bugMode == true)
                {
                    spriteBatch.Draw(spriteSheet, new Vector2(curSpriteRect.hitbox.X, curSpriteRect.hitbox.Y), new Rectangle(590, 485, curSpriteRect.hitbox.Width, curSpriteRect.hitbox.Height), Color.Blue, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                    spriteBatch.Draw(spriteSheet, Position - offset, curSpriteRect.spriteBox, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                    spriteBatch.Draw(spriteSheet, new Vector2(trueAttackHitbox.X, trueAttackHitbox.Y), new Rectangle(590, 485, trueAttackHitbox.Width, trueAttackHitbox.Height), Color.Red, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                }
                else
                {
                    //spriteBatch.Draw(spriteSheet, new Vector2(hitbox.X, hitbox.Y), new Rectangle(590, 485, hitbox.Width, hitbox.Height), Color.Blue, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                    spriteBatch.Draw(spriteSheet, Position - offset, curSpriteRect.spriteBox, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                    //spriteBatch.Draw(spriteSheet, new Vector2(trueHitbox.X, trueHitbox.Y), new Rectangle(590,485,trueHitbox.Width,trueHitbox.Height), Color.Red, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                }

                spriteBatch.End();
            }
            else
            {
                spriteBatch.Begin();
                if (bugMode == true)
                {
                    spriteBatch.Draw(spriteSheet, new Vector2(curSpriteRect.hitbox.X, curSpriteRect.hitbox.Y), new Rectangle(590, 485, curSpriteRect.hitbox.Width, curSpriteRect.hitbox.Height), Color.Blue, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                    spriteBatch.Draw(spriteSheet, Position - offset, curSpriteRect.spriteBox, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0);
                    spriteBatch.Draw(spriteSheet, new Vector2(trueAttackHitbox.X, trueAttackHitbox.Y), new Rectangle(590, 485, trueAttackHitbox.Width, trueAttackHitbox.Height), Color.Red, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                }
                else
                {
                    //spriteBatch.Draw(spriteSheet, new Vector2(hitbox.X, hitbox.Y), new Rectangle(590, 485, hitbox.Width, hitbox.Height), Color.Blue, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                    spriteBatch.Draw(spriteSheet, Position - offset, curSpriteRect.spriteBox, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0);
                    //spriteBatch.Draw(spriteSheet, new Vector2(trueHitbox.X, trueHitbox.Y), new Rectangle(590, 485, trueHitbox.Width, trueHitbox.Height), Color.Red, 0, new Vector2(0, 0), 1, SpriteEffects.None, 0);
                }
                spriteBatch.End();
            }

            base.Draw(gameTime);
        }

        public override void Update(GameTime gameTime)
        {
            if (gameOn == false)
                return;

            if (bugTimer != 0)
            {
                bugTimer--;
            }
            const int frameDivider = 3;
            int animMCounter = animCounter / frameDivider;  //to swap the sprite every 3 frames
            spriteFrame lastSpriteRect = curSpriteRect;

            //if the hitStunCounter > 0 but they aren't in a hit_stun state
            /*
            if (hitStunCounter > 0 && state != HIT_STUN && state != HIT_AIR_STUN)
            {
                if (state == JUMP || state == JUMP_ATTACK)
                    state = HIT_AIR_STUN;
                else
                    state = HIT_STUN;
            }*/

            //check to see if hit invlunerability is over
            for (int pNum = 0; pNum < 4; pNum++)
            {
                if (hitInvulnCounter[pNum] > 0)
                {
                    hitInvulnCounter[pNum]--;
                }
            }

            //decrement lag. currently only used for shield-exit lag
            if (lag > 0)
                lag--;
           
            


            //set the correct sprite
            switch (state)
            {
                case NP_DEAD:
                    curSpriteRect = new spriteFrame(new Rectangle(), new Rectangle(), new Rectangle());
                    break;
                case NEUTRAL:
                    curSpriteRect = standingLoop[animMCounter];
                    animCounter++;
                    animMCounter = animCounter / frameDivider;
                    if (animMCounter == standingLoop.Length)   //reset standing loop
                        animCounter = 0;
                    break;
                case ATTACK:
                    curSpriteRect = attackLoop[attackState][animMCounter];
                    animCounter++;
                    animMCounter = animCounter / frameDivider;
                    if (animMCounter == attackLoop[attackState].Length) //end the attack animation
                    {
                        animCounter = 0;
                        attackState = NO_ATTACK;
                        state = NEUTRAL;
                    }

                    //fire special cases
                    

                    break;
                case RUN:
                    curSpriteRect = runLoop[animMCounter];
                    animCounter++;
                    animMCounter = animCounter / frameDivider;
                    if (animMCounter == runLoop.Length) //reset the run animation
                        animCounter = 0;
                    break;
                case JUMP:
                    curSpriteRect = jumpLoop[animMCounter];
                    if (animMCounter < jumpLoop.Length - 1)
                    { animCounter++; }
                    animMCounter = animCounter / frameDivider;
                    /*
                    if (animMCounter == standingLoop.Length)    //reset the standing animation (unless we have a jump one)
                        animCounter = 0;*/
                    break;
                case JUMP_ATTACK:
                    curSpriteRect = attackLoop[attackState][animMCounter];
                    animCounter++;

                    animMCounter = animCounter / frameDivider;
                    if (animMCounter == attackLoop[attackState].Length)    //end the jump attack
                    {
                        animCounter = 0;
                        attackState = NO_ATTACK;
                        state = JUMP;
                        curSpriteRect = jumpLoop[0]; //a quick-fix for a problem: offset math causes a glitchy movement when attempting to turn around immediately after an aerial attack 
                    }

                    //special case - air fire moves 
                    if (playerType == Fight.FIRE)
                    {
                        if (attackState == AIRSPECIAL_ATTACK && animCounter == 7)
                            Velocity += new Vector2(0, 15);

                    }
                    break;
                case SHIELD:
                    curSpriteRect = blockingLoop[animMCounter];
                    animCounter++;
                    animMCounter = animCounter / frameDivider;
                    if (animMCounter == blockingLoop.Length)
                        animCounter = 0;
                    break;
                case HIT_STUN:
                    curSpriteRect = hitstunned;
                    hitStunCounter--;
                    if (hitStunCounter <= 0)
                    {
                        hitStunCounter = 0;
                        animCounter = 0;
                        state = NEUTRAL;
                    }
                    break;
                case HIT_AIR_STUN:
                    curSpriteRect = hitstunned;
                    hitStunCounter--;
                    if (hitStunCounter <= 0)
                    {
                        hitStunCounter = 0;
                        animCounter = 0;
                        state = JUMP;
                    }
                    break;
                case LANDING:
                    curSpriteRect = landing;
                    if (lag == 0)
                        state = NEUTRAL;
                    break;

                case THROWN:
                    curSpriteRect = hitstunned;
                    animCounter++;
                    if (animCounter == 1)
                        Position -= new Vector2(10, 0);
                    else if (animCounter == 9)
                    {
                        Velocity += new Vector2(15 * thrownDirection, -15 - pain/5);
                        state = HIT_AIR_STUN;
                        hitStunCounter = 30;
                    }
                    
                    
                    break;




            }

           
            //update position based on changing sprite sizes
            //hitbox = new Rectangle((int)(Position.X - offset.X), (int)(Position.Y - offset.Y), (int)curSpriteRect.Width, (int)curSpriteRect.Height);
            Position -= new Vector2(0, (curSpriteRect.spriteBox.Height - lastSpriteRect.spriteBox.Height));
            if (direction == LEFT)
            {
                Position -= new Vector2((curSpriteRect.spriteBox.Width - lastSpriteRect.spriteBox.Width) / 2, 0);
            }
            else
            {
                Position += new Vector2((curSpriteRect.spriteBox.Width - lastSpriteRect.spriteBox.Width) / 2, 0);
            }

            offset = new Vector2(curSpriteRect.spriteBox.Width / 2, curSpriteRect.hitbox.Height / 2);

            

            //update true hitbox
            Rectangle tempHitbox;
            Vector2 pos = (Position - offset);
            if (direction == Player.RIGHT) // facing right
            {

                tempHitbox = new Rectangle(curSpriteRect.hitbox.X + (int)pos.X, curSpriteRect.hitbox.Y + (int)pos.Y,
                                           curSpriteRect.hitbox.Width, curSpriteRect.hitbox.Height);
            }
            else // facing left
            {
                tempHitbox = new Rectangle((int)pos.X + curSpriteRect.spriteBox.Width - curSpriteRect.hitbox.X - curSpriteRect.hitbox.Width,
                                             (int)pos.Y + curSpriteRect.hitbox.Y,
                                             curSpriteRect.hitbox.Width, curSpriteRect.hitbox.Height);
            }
            trueHitBox = tempHitbox;


            base.Update(gameTime);
        }

        public void attacked(Attack attack, int hitDirection, int attacker)
        {
            //Special Case: Invulnerable to attack
            if (hitInvulnCounter[attacker - 1] > 0 && hitInvulnMove[attacker - 1] == attack.type)
                return;

            //Special Case: Shielding
            if (state == SHIELD && attack.type != SUPER_ATTACK)
                return;

            //Special Case: Dead
            if (pain == 100 && (attack.type == HEAVY_ATTACK || attack.type == SUPER_ATTACK))
            {
                Velocity += new Vector2(hitDirection * 60f, -15f);
                Position += Velocity;
                state = NP_DEAD;
                return;
            }

            float knockbackX = attack.knockbackX + pain / 3;

            /*if (state == JUMP || state == JUMP_ATTACK || state == HIT_AIR_STUN)
                knockbackX /= 3;
            */ 

            float knockBackY = attack.knockbackY;
            if (knockBackY < 0)
                state = JUMP;

            pain += attack.damage;
            hitStunCounter = attack.hitStun;
            
            Velocity = new Vector2(hitDirection * knockbackX, knockBackY);

            hitInvulnCounter[attacker - 1] = attack.invulnFrames;
            hitInvulnMove[attacker - 1] = attack.type;

            if (pain > 100)
                pain = 100;

            if (state == JUMP || state == JUMP_ATTACK || state == HIT_AIR_STUN)
                state = HIT_AIR_STUN;
            else if (state != THROWN)
                state = HIT_STUN;
        }




        public void loadRectangles()
        {
            playerTypes pTypes = new playerTypes();
            standingLoop = pTypes.getStandingLoop(playerType);
            blockingLoop = pTypes.getBlockLoop(playerType);
            jumpLoop = pTypes.getJumpLoop(playerType);
            attackLoop = pTypes.getAttackLoops(playerType);
            runLoop = pTypes.getRunLoop(playerType);
            landing = pTypes.getLandingLoop(playerType);
            hitstunned = pTypes.getHitStunLoop(playerType);
            spriteSheet = Game.Content.Load<Texture2D>(pTypes.getSpriteSheet(playerType));


            /*
            standingLoop = new Rectangle[12];
            jumpLoop = new Rectangle[5];
            runLoop = new Rectangle[6];
            attackLoop = new Rectangle[6][];
            attackLoop[0] = new Rectangle[8];
            attackLoop[1] = new Rectangle[13];
            attackLoop[2] = new Rectangle[13];
            attackLoop[3] = new Rectangle[8];
            attackLoop[4] = new Rectangle[8];
            attackLoop[5] = new Rectangle[18];

            // all facing right
            hitstunned = new Rectangle(0, 416, 100, 128);
            blocking = new Rectangle(820, 296, 100, 128);

            standingLoop[0] = new Rectangle(0, 546, 100, 128);
            standingLoop[1] = new Rectangle(0, 546, 100, 128);
            standingLoop[2] = new Rectangle(102, 494, 100, 128);
            standingLoop[3] = new Rectangle(102, 494, 100, 128);
            standingLoop[4] = new Rectangle(204, 494, 100, 128);
            standingLoop[5] = new Rectangle(204, 494, 100, 128);
            standingLoop[6] = new Rectangle(306, 494, 100, 128);
            standingLoop[7] = new Rectangle(306, 494, 100, 128);
            standingLoop[8] = new Rectangle(204, 494, 100, 128); //recycle
            standingLoop[9] = new Rectangle(204, 494, 100, 128); //recycle
            standingLoop[10] = new Rectangle(102, 494, 100, 128); //recycle
            standingLoop[11] = new Rectangle(102, 494, 100, 128); //recycle

            runLoop[0] = new Rectangle(304, 376, 140, 116);
            runLoop[1] = new Rectangle(304, 376, 140, 116);
            runLoop[2] = new Rectangle(486, 0, 140, 116);
            runLoop[3] = new Rectangle(486, 0, 140, 116);
            runLoop[4] = new Rectangle(486, 118, 140, 116);
            runLoop[5] = new Rectangle(486, 118, 140, 116);

            jumpLoop[0] = new Rectangle(446, 392, 80, 160);
            jumpLoop[1] = new Rectangle(446, 392, 80, 160);
            jumpLoop[2] = new Rectangle(408, 554, 80, 160);
            jumpLoop[3] = new Rectangle(408, 554, 80, 160);
            jumpLoop[4] = new Rectangle(408, 554, 80, 160);

            attackLoop[LIGHT_ATTACK][0] = new Rectangle(162, 376, 140, 116);
            attackLoop[LIGHT_ATTACK][1] = new Rectangle(162, 376, 140, 116);
            attackLoop[LIGHT_ATTACK][2] = new Rectangle(162, 376, 140, 116); //3 frame wind-up
            attackLoop[LIGHT_ATTACK][3] = new Rectangle(324, 244, 140, 116); //hitbox comes out
            attackLoop[LIGHT_ATTACK][4] = new Rectangle(324, 244, 140, 116); //hitbox out
            attackLoop[LIGHT_ATTACK][5] = new Rectangle(324, 244, 140, 116); //hitbox out
            attackLoop[LIGHT_ATTACK][6] = new Rectangle(162, 376, 140, 116); //recycle
            attackLoop[LIGHT_ATTACK][7] = new Rectangle(162, 376, 140, 116); //recycle

            attackLoop[HEAVY_ATTACK][0] = new Rectangle(0, 0, 160, 140);
            attackLoop[HEAVY_ATTACK][1] = new Rectangle(0, 0, 160, 140);
            attackLoop[HEAVY_ATTACK][2] = new Rectangle(0, 0, 160, 140);
            attackLoop[HEAVY_ATTACK][3] = new Rectangle(0, 0, 160, 140); //4 frame wind-up
            attackLoop[HEAVY_ATTACK][4] = new Rectangle(162, 0, 160, 140); //hitbox comes out
            attackLoop[HEAVY_ATTACK][5] = new Rectangle(162, 0, 160, 140); //hitbox out
            attackLoop[HEAVY_ATTACK][6] = new Rectangle(162, 0, 160, 140); //hitbox out
            attackLoop[HEAVY_ATTACK][7] = new Rectangle(324, 0, 160, 140); //new hitbox?
            attackLoop[HEAVY_ATTACK][8] = new Rectangle(324, 0, 160, 140); //new hitbox?
            attackLoop[HEAVY_ATTACK][9] = new Rectangle(324, 0, 160, 140); //new hitbox?
            attackLoop[HEAVY_ATTACK][10] = new Rectangle(0, 142, 160, 140); //lag, no hitbox
            attackLoop[HEAVY_ATTACK][11] = new Rectangle(0, 142, 160, 140); //lag, no hitbox
            attackLoop[HEAVY_ATTACK][12] = new Rectangle(0, 142, 160, 140); //lag, no hitbox

            attackLoop[SPECIAL_ATTACK][0] = new Rectangle(0, 284, 160, 130);
            attackLoop[SPECIAL_ATTACK][1] = new Rectangle(0, 284, 160, 130);
            attackLoop[SPECIAL_ATTACK][2] = new Rectangle(0, 284, 160, 130); //6 fram wind-up
            attackLoop[SPECIAL_ATTACK][3] = new Rectangle(0, 284, 160, 130);
            attackLoop[SPECIAL_ATTACK][4] = new Rectangle(0, 284, 160, 130);
            attackLoop[SPECIAL_ATTACK][5] = new Rectangle(0, 284, 160, 130); //6 fram wind-up
            attackLoop[SPECIAL_ATTACK][6] = new Rectangle(162, 142, 160, 130); //projectile comes out
            attackLoop[SPECIAL_ATTACK][7] = new Rectangle(162, 142, 160, 130); //lag
            attackLoop[SPECIAL_ATTACK][8] = new Rectangle(162, 142, 160, 130); //lag
            attackLoop[SPECIAL_ATTACK][9] = new Rectangle(162, 142, 160, 130); //lag
            attackLoop[SPECIAL_ATTACK][10] = new Rectangle(162, 142, 160, 130); //lag
            attackLoop[SPECIAL_ATTACK][11] = new Rectangle(162, 142, 160, 130); //lag
            attackLoop[SPECIAL_ATTACK][12] = new Rectangle(162, 142, 160, 130); //lag

            attackLoop[AIRLIGHT_ATTACK][0] = new Rectangle(162, 274, 160, 100);
            attackLoop[AIRLIGHT_ATTACK][1] = new Rectangle(162, 274, 160, 100); //2 frame wind-up
            attackLoop[AIRLIGHT_ATTACK][2] = new Rectangle(324, 142, 160, 100); //hitbox comes out
            attackLoop[AIRLIGHT_ATTACK][3] = new Rectangle(324, 142, 160, 100); //hitbox out
            attackLoop[AIRLIGHT_ATTACK][4] = new Rectangle(324, 142, 160, 100); //hitbox out
            attackLoop[AIRLIGHT_ATTACK][5] = new Rectangle(324, 142, 160, 100); //hitbox out
            attackLoop[AIRLIGHT_ATTACK][6] = new Rectangle(162, 274, 160, 100);
            attackLoop[AIRLIGHT_ATTACK][7] = new Rectangle(162, 274, 160, 100); //2 frame wind-up

            attackLoop[AIRHEAVY_ATTACK][0] = new Rectangle(628, 0, 120, 146);
            attackLoop[AIRHEAVY_ATTACK][1] = new Rectangle(628, 0, 120, 146);
            attackLoop[AIRHEAVY_ATTACK][2] = new Rectangle(628, 0, 120, 146);
            attackLoop[AIRHEAVY_ATTACK][3] = new Rectangle(628, 0, 120, 146); //4 frame wind-up
            attackLoop[AIRHEAVY_ATTACK][4] = new Rectangle(466, 244, 120, 146); //hitbox comes out
            attackLoop[AIRHEAVY_ATTACK][5] = new Rectangle(466, 244, 120, 146); //hitbox out
            attackLoop[AIRHEAVY_ATTACK][6] = new Rectangle(466, 244, 120, 146); //hitbox out
            attackLoop[AIRHEAVY_ATTACK][7] = new Rectangle(466, 244, 120, 146); //hitbox out

            attackLoop[SUPER_ATTACK][0] = new Rectangle(750, 0, 120, 146);
            attackLoop[SUPER_ATTACK][1] = new Rectangle(750, 0, 120, 146);
            attackLoop[SUPER_ATTACK][2] = new Rectangle(750, 0, 120, 146);
            attackLoop[SUPER_ATTACK][3] = new Rectangle(750, 0, 120, 146); //4 frame wind-up
            attackLoop[SUPER_ATTACK][4] = new Rectangle(628, 148, 120, 146); //first hitbox, CHAAAARGE!!!
            attackLoop[SUPER_ATTACK][5] = new Rectangle(628, 148, 120, 146);
            attackLoop[SUPER_ATTACK][6] = new Rectangle(628, 148, 120, 146);
            attackLoop[SUPER_ATTACK][7] = new Rectangle(628, 148, 120, 146);
            attackLoop[SUPER_ATTACK][8] = new Rectangle(628, 148, 120, 146);
            attackLoop[SUPER_ATTACK][9] = new Rectangle(710, 296, 108, 146); //uppercut hitbox
            attackLoop[SUPER_ATTACK][10] = new Rectangle(710, 296, 108, 146);
            attackLoop[SUPER_ATTACK][11] = new Rectangle(710, 296, 108, 146);
            attackLoop[SUPER_ATTACK][12] = new Rectangle(750, 148, 120, 146); //new hitbox? or lag?
            attackLoop[SUPER_ATTACK][13] = new Rectangle(750, 148, 120, 146);
            attackLoop[SUPER_ATTACK][14] = new Rectangle(750, 148, 120, 146);
            attackLoop[SUPER_ATTACK][15] = new Rectangle(588, 296, 120, 146); //lag
            attackLoop[SUPER_ATTACK][16] = new Rectangle(588, 296, 120, 146);
            attackLoop[SUPER_ATTACK][17] = new Rectangle(588, 296, 120, 146);

            attackHitboxes = new Rectangle[6][];
            attackHitboxes[0] = new Rectangle[8];
            attackHitboxes[1] = new Rectangle[13];
            attackHitboxes[2] = new Rectangle[13];
            attackHitboxes[3] = new Rectangle[8];
            attackHitboxes[4] = new Rectangle[8];
            attackHitboxes[5] = new Rectangle[18];

            attackHitboxes[LIGHT_ATTACK][0] = noAttackHitbox;
            attackHitboxes[LIGHT_ATTACK][1] = noAttackHitbox;
            attackHitboxes[LIGHT_ATTACK][2] = noAttackHitbox; //3 frame wind-up
            attackHitboxes[LIGHT_ATTACK][3] = new Rectangle(426 - attackLoop[LIGHT_ATTACK][3].X, 244 - attackLoop[LIGHT_ATTACK][3].Y, 40, 40); //hitbox comes out
            attackHitboxes[LIGHT_ATTACK][4] = attackHitboxes[LIGHT_ATTACK][3]; //hitbox out
            attackHitboxes[LIGHT_ATTACK][5] = attackHitboxes[LIGHT_ATTACK][3]; //hitbox out
            attackHitboxes[LIGHT_ATTACK][6] = noAttackHitbox;
            attackHitboxes[LIGHT_ATTACK][7] = noAttackHitbox;

            attackHitboxes[HEAVY_ATTACK][0] = noAttackHitbox;
            attackHitboxes[HEAVY_ATTACK][1] = noAttackHitbox;
            attackHitboxes[HEAVY_ATTACK][2] = noAttackHitbox;
            attackHitboxes[HEAVY_ATTACK][3] = noAttackHitbox;//4 frame wind-up
            attackHitboxes[HEAVY_ATTACK][4] = new Rectangle(266 - attackLoop[HEAVY_ATTACK][4].X, 38 - attackLoop[HEAVY_ATTACK][4].Y, 60, 50); //hitbox comes out
            attackHitboxes[HEAVY_ATTACK][5] = attackHitboxes[HEAVY_ATTACK][4];  //hitbox out
            attackHitboxes[HEAVY_ATTACK][6] = attackHitboxes[HEAVY_ATTACK][4]; //hitbox out
            attackHitboxes[HEAVY_ATTACK][7] = new Rectangle(348 - attackLoop[HEAVY_ATTACK][7].X, 6 - attackLoop[HEAVY_ATTACK][4].Y, 100, 50); //new hitbox
            attackHitboxes[HEAVY_ATTACK][8] = attackHitboxes[HEAVY_ATTACK][7]; //new hitbox
            attackHitboxes[HEAVY_ATTACK][9] = attackHitboxes[HEAVY_ATTACK][7]; //new hitbox
            attackHitboxes[HEAVY_ATTACK][10] = noAttackHitbox; //lag, no hitbox
            attackHitboxes[HEAVY_ATTACK][11] = noAttackHitbox; //lag, no hitbox
            attackHitboxes[HEAVY_ATTACK][12] = noAttackHitbox; //lag, no hitbox

            attackHitboxes[SPECIAL_ATTACK][0] = noAttackHitbox;
            attackHitboxes[SPECIAL_ATTACK][1] = noAttackHitbox;
            attackHitboxes[SPECIAL_ATTACK][2] = noAttackHitbox;
            attackHitboxes[SPECIAL_ATTACK][3] = noAttackHitbox;
            attackHitboxes[SPECIAL_ATTACK][4] = noAttackHitbox;
            attackHitboxes[SPECIAL_ATTACK][5] = noAttackHitbox; //6 fram wind-up
            attackHitboxes[SPECIAL_ATTACK][6] = noAttackHitbox; //projectile comes out
            attackHitboxes[SPECIAL_ATTACK][7] = noAttackHitbox; //lag
            attackHitboxes[SPECIAL_ATTACK][8] = noAttackHitbox; //lag
            attackHitboxes[SPECIAL_ATTACK][9] = noAttackHitbox; //lag
            attackHitboxes[SPECIAL_ATTACK][10] = noAttackHitbox; //lag
            attackHitboxes[SPECIAL_ATTACK][11] = noAttackHitbox; //lag
            attackHitboxes[SPECIAL_ATTACK][12] = noAttackHitbox; //lag

            attackHitboxes[AIRLIGHT_ATTACK][0] = noAttackHitbox;
            attackHitboxes[AIRLIGHT_ATTACK][1] = noAttackHitbox; //2 frame wind-up
            attackHitboxes[AIRLIGHT_ATTACK][2] = new Rectangle(416 - attackLoop[AIRLIGHT_ATTACK][2].X, 180 - attackLoop[AIRLIGHT_ATTACK][2].Y, 60, 60); //hitbox comes out
            attackHitboxes[AIRLIGHT_ATTACK][3] = attackHitboxes[AIRLIGHT_ATTACK][2]; //hitbox out
            attackHitboxes[AIRLIGHT_ATTACK][4] = attackHitboxes[AIRLIGHT_ATTACK][2]; //hitbox out
            attackHitboxes[AIRLIGHT_ATTACK][5] = attackHitboxes[AIRLIGHT_ATTACK][2]; //hitbox out
            attackHitboxes[AIRLIGHT_ATTACK][6] = noAttackHitbox;
            attackHitboxes[AIRLIGHT_ATTACK][7] = noAttackHitbox; //2 frame wind-up

            attackHitboxes[AIRHEAVY_ATTACK][0] = noAttackHitbox;
            attackHitboxes[AIRHEAVY_ATTACK][1] = noAttackHitbox;
            attackHitboxes[AIRHEAVY_ATTACK][2] = noAttackHitbox;
            attackHitboxes[AIRHEAVY_ATTACK][3] = noAttackHitbox; //4 frame wind-up
            attackHitboxes[AIRHEAVY_ATTACK][4] = new Rectangle(484 - attackLoop[AIRHEAVY_ATTACK][4].X, 288 - attackLoop[AIRHEAVY_ATTACK][4].Y, 80, 100);//hitbox comes out
            attackHitboxes[AIRHEAVY_ATTACK][5] = attackHitboxes[AIRHEAVY_ATTACK][4]; //hitbox out
            attackHitboxes[AIRHEAVY_ATTACK][6] = attackHitboxes[AIRHEAVY_ATTACK][4]; //hitbox out
            attackHitboxes[AIRHEAVY_ATTACK][7] = attackHitboxes[AIRHEAVY_ATTACK][4]; //hitbox out

            attackHitboxes[SUPER_ATTACK][0] = noAttackHitbox;
            attackHitboxes[SUPER_ATTACK][1] = noAttackHitbox;
            attackHitboxes[SUPER_ATTACK][2] = noAttackHitbox;
            attackHitboxes[SUPER_ATTACK][3] = noAttackHitbox; //4 frame wind-up
            attackHitboxes[SUPER_ATTACK][4] = new Rectangle(700 - attackLoop[SUPER_ATTACK][4].X, 166 - attackLoop[SUPER_ATTACK][4].Y, 44, 60); //first hitbox, CHAAAARGE!!!
            attackHitboxes[SUPER_ATTACK][5] = attackHitboxes[SUPER_ATTACK][4];
            attackHitboxes[SUPER_ATTACK][6] = attackHitboxes[SUPER_ATTACK][4];
            attackHitboxes[SUPER_ATTACK][7] = attackHitboxes[SUPER_ATTACK][4];
            attackHitboxes[SUPER_ATTACK][8] = attackHitboxes[SUPER_ATTACK][4];
            attackHitboxes[SUPER_ATTACK][9] = new Rectangle(756 - attackLoop[SUPER_ATTACK][9].X, 300 - attackLoop[SUPER_ATTACK][9].Y, 50, 74); //uppercut hitbox
            attackHitboxes[SUPER_ATTACK][10] = attackHitboxes[SUPER_ATTACK][9];
            attackHitboxes[SUPER_ATTACK][11] = attackHitboxes[SUPER_ATTACK][9];
            attackHitboxes[SUPER_ATTACK][12] = new Rectangle(800 - attackLoop[SUPER_ATTACK][12].X, 156 - attackLoop[SUPER_ATTACK][12].Y, 50, 50); //new hitbox
            attackHitboxes[SUPER_ATTACK][13] = attackHitboxes[SUPER_ATTACK][12];
            attackHitboxes[SUPER_ATTACK][14] = attackHitboxes[SUPER_ATTACK][12];
            attackHitboxes[SUPER_ATTACK][15] = noAttackHitbox; //lag
            attackHitboxes[SUPER_ATTACK][16] = noAttackHitbox;
            attackHitboxes[SUPER_ATTACK][17] = noAttackHitbox;
             * */
        }

    }
}
